package com.budwk.app.sqfwV2.enums;

import com.budwk.app.sqfwDoc.codeGenerator.excelGenerate.BaseTemplateExcelGenerator;
import com.budwk.app.sqfwV2.generator.dayingRoadExcel.*;
import lombok.Getter;

import java.util.Arrays;
import java.util.Optional;

/**
 * 大营路文件对应枚举
 */
@Getter
public enum DayingRoadFileServiceEnum {

    DAYING_ROAD_EXCEL_SAFE("daying_road_sanqingdan_safe", new ThreeDetailedGenerator(), "sqfwV2/daYingLu/threeDetailed.xlsx", "隐患数据|台账|餐饮|店面|游摊", "/preview/safety/dayinglu/daying_road_sanqingdan_safe.png", "0f7d1de4e9294372b03bf011299d9c97d"), // 安全隐患“三清单”/Excle
    DAYING_ROAD_EXCEL_LEDGER("daying_road_fire_safety_ledger", new InspectionOnPatrolGenerator(), "sqfwV2/daYingLu/inspectionOnPatrol.xlsx", "消防数据|台账", "/preview/safety/dayinglu/daying_road_fire_safety_ledger.png", "44c62002d221472482690694e316d1e5"), // 消防安全巡查检查台账/Excel
    DAYING_ROAD_EXCEL_THREEONE("daying_road_three_in_one", new ThreeAndOneSiteGenerator(), "sqfwV2/daYingLu/threeAndOneSite.xlsx", "部分数据|台账|三合一", "/preview/safety/dayinglu/daying_road_three_in_one.png", "ba4111004bf94245b373d6e19b448431"), // “三合一”场所台账/Excel
    DAYING_ROAD_EXCEL_FIRE("daying_road_major_fire_safety", new GreatRiskHiddenGenerator(), "sqfwV2/daYingLu/greatRiskHidden.xlsx", "隐患数据|统计|三合一", "/preview/safety/dayinglu/daying_road_major_fire_safety.png", "f14b59a262594135bd113911181e2521"), // 云岩区消防安全重大风险隐患专项排查整治进度统计表
    DAYING_ROAD_EXCEL_FIRE_SAFETY("daying_road_district_fire_safety", new KeyLocationBookGenerator(), "sqfwV2/daYingLu/keyLocationStandingBook.xlsx", "部分数据|台账|重点场所", "/preview/safety/dayinglu/daying_road_district_fire_safety.png", "71a8135b2ae647b88165ceb55cca56c2"), // 云岩区消防安全重大风险隐患台账
    DAYING_ROAD_EXCEL_SPECIAL("daying_road_special_investigation", new SafetyRiskRecBookExcelGenerator(), "sqfwV2/daYingLu/safetyRiskRecStandingBook.xlsx", "部分数据|台账|重点场所", "/preview/safety/dayinglu/daying_road_special_investigation.png", "202bf961ffad4282833986710c1e2126"), // 消防安全重大风险隐患专项排查整治附件3
    DAYING_ROAD_EXCEL_FUAL("daying_road_summary_fuel", new CateringIndustryGenerator(), "sqfwV2/daYingLu/cateringIndustry.xlsx", "部分数据|台账|瓶装燃气|用电|管道燃气|醇基", "/preview/safety/dayinglu/daying_road_summary_fuel.png", "e8c70689143646ae8fe61b71fa4d17f9"), // 燃气、燃料排查情况汇总/Excel
    DAYING_ROAD_EXCEL_SCALE("daying_road_small_scale_production", new SmallBusinessPremisesBookGenerator(), "sqfwV2/daYingLu/smallBusinessPremisesStandingBook.xlsx", "全部数据|台账", "/preview/safety/dayinglu/daying_road_small_scale_production.png", "6720432463e74e1db47009de859d0554"), // 小型生产场所台账
    DAYING_ROAD_EXCEL_REPORT("daying_road_weekly_report_safety", new GasSafetyWeeklyGenerator(), "sqfwV2/daYingLu/gasSafetyInsStatisticsWeeklyReport.xlsx", "隐患数据|统计|店面|游摊", "/preview/safety/dayinglu/daying_road_weekly_report_safety.png", "30df0ed5e4de46b8adf0391de04a8d96"), // 附件1：燃气安全排查统计周报表/Excel
    DAYING_ROAD_EXCEL_STALLS("daying_road_market_stalls", new NightStallBookGenerator(), "sqfwV2/daYingLu/nightStallGasStandingBook.xlsx", "部分数据|台账|游摊|用电|燃气", "/preview/safety/dayinglu/daying_road_market_stalls.png", "1fe676f16e524585b942528b8bd85afe"), // 附件3：夜市摊点、游摊燃气台账/Excel
    DAYING_ROAD_EXCEL_CATER("daying_road_urban_catering_ledger", new UrbanGasGenerator(), "sqfwV2/daYingLu/urbanGasStandingBook.xlsx", "部分数据|台账|非游摊|用电|燃气", "/preview/safety/dayinglu/daying_road_urban_catering_ledger.png", "3e645872670e44a59d82eca93dbe95d2"), // 附件4：城镇燃气餐饮用户台账表/Excel
    DAYING_ROAD_EXCEL_SITES("daying_road_security_risk_sites", new SecurityKeyBookGenerator(), "sqfwV2/daYingLu/publicSecurityKeyRiskAreasStandingBook.xlsx", "全部数据|合集|全部表单", "", "162c97214715425bb7ca88e0ff3ad707"); // 社会治安重点风险场所台账/Excel

    private final String code; // 编码

    private final BaseTemplateExcelGenerator service;

    private final String filePath;

    private final String label;

    private final String previewImage;

    private final String templateId; // 模板id

    // pdf预览图地址
    public static final String PDF_PREVIEW = "/preview/safety/dayinglu/daying_road_safety_rectification_pdf.png";

    DayingRoadFileServiceEnum(String code, BaseTemplateExcelGenerator service, String filePath, String label, String previewImage, String templateId) {
        this.code = code;
        this.service = service;
        this.filePath = filePath;
        this.label = label;
        this.previewImage = previewImage;
        this.templateId = templateId;
    }

    /**
     * @param code
     * @return
     */
    public static DayingRoadFileServiceEnum getByCode(String code) {
        Optional<DayingRoadFileServiceEnum> optional = Arrays.stream(values()).filter(e -> e.getCode().equals(code)).findFirst();
        return optional.orElse(null);
    }

    /**
     * @param code
     * @return
     */
    public static String getLabel(String code) {
        Optional<DayingRoadFileServiceEnum> optional = Arrays.stream(values()).filter(e -> e.getCode().equals(code)).findFirst();
        return optional.map(DayingRoadFileServiceEnum::getLabel).orElse(null);
    }
}
